clear all
program drop _all
set more off
set mem 600m

cd "C:\Users\master\Dropbox\Research\mexican_repatriates2\data\kwan"
use "D:\raw\1930.dta"

keep if sex==1

keep statefip county occ1950 empstat empstatd classwkrd gq school bpl bpld fbpl mbpl occ1950 sea

keep if occ1950<979
keep if empstat==1
drop if empstatd==13
drop if classwkrd==29
drop if school==2

keep if bpld<15000 | bpld==90011 | bpld==90021 | bpld==90022
drop if bpl==200 | fbpl==200 | mbpl==200

replace county = (1000*statefip) + (county/10)

* Arizona
replace county = 4009 if county == 4011

* Louisiana
replace county = 22097 if county == 22039
replace county = 22019 if county == 22011 | county == 22003 | county == 22053

* New Mexico
replace county = 35017 if county == 35023
replace county = 35019 if county == 35011
replace county = 35005 if county == 35025

* Nevada
replace county = 32013 if county == 32027
replace county = 32009 if county == 32021

* Oklahoma
replace county = 40031 if county == 40033

* Oregon
replace county = 41013 if county == 41031 | county == 41017

* Texas
replace county = 48141 if county == 48229 | county == 48109
replace county = 48137 if county == 48385
replace county = 48355 if county == 48273 | county == 42849
replace county = 48061 if county == 48489
replace county = 48427 if county == 48407

* Utah
replace county = 49047 if county == 49009
replace county = 49051 if county == 49013

merge m:m occ1950 using "C:\Users\master\Dropbox\Research\mexican_repatriates2\data\kwan\wage_by_occupation.dta", nogenerate

drop if wage==.

collapse (mean) wage30_male=wage, by(county)

save wage1930_male.dta, replace 


